<script type="text/javascript">
var swfu_
$(function(){
	var btn = $("#upbtn").get(0);
    swfu_= new SWFUpload({
				upload_url: "/file/swfup",
                file_post_name: "filedata",
				file_size_limit : "1 MB",
				file_types : "*.jpg;*.png;*.jpeg'*.bmp",
				file_types_description : "bmp,jpeg,jpg,png图片",
				file_upload_limit :5,
				
				swfupload_preload_handler : preLoad,
				swfupload_load_failed_handler : loadFailed,
				file_queue_error_handler : fileQueueError,
				file_dialog_complete_handler : fileDialogComplete,
				upload_progress_handler : uploadProgress,
				upload_error_handler : uploadError,
				upload_success_handler : function(f,data){
					eval("var json="+data+";");
					if(json.suc==true){
						var htmstr="";
						htmstr+="<div style='float:left;'>";
						htmstr+='<input type="hidden" name="logos" value="'+json.msg+'">';
						htmstr+='<img height="200px"src="'+json.msg+'"/>';
						htmstr+='<br/><a href="#" class="easyui-linkbutton" onclick="javascript:$(this).parent().remove();">删除</a>';
						htmstr+='</div>';
						$("#img_div").append(htmstr);
						$('.easyui-linkbutton').linkbutton({    
						    iconCls: 'icon-remove'
						}); 
					}else{
						$.messager.alert('警告','文件上传出错');
					}
				},
				upload_complete_handler : uploadComplete,
				// Button Settings
				button_placeholder_id:"upbtn",
				button_image_url : "/img/SmallSpyGlassWithTransperancy_17x18.png",
				button_width: 80,
				button_height: 18,
				button_text : '<span class="button">上传商户图片</span>',
				button_text_style : '.button {font-size: 12pt; }',
				button_text_top_padding: 0,
				button_text_left_padding: 18,
				button_disabled : false,
				button_window_mode: SWFUpload.WINDOW_MODE.TRANSPARENT,
				button_cursor: SWFUpload.CURSOR.HAND,
				// Flash Settings
				flash_url : swfuploaddir+"/swfupload.swf",
				flash9_url : swfuploaddir+"/swfupload_fp9.swf",
				custom_settings : {
				//	upload_target : "divFileProgressContainer",
					thumbnail_height: 500,
					thumbnail_width: 500,
					thumbnail_quality: 100
				},
				debug: true
			});
			
			$("#shop_id").combotree({    
			    url: '/shop/combotree/${(po.id)!}',  
			    multiple:true,
		    	editable:false,
			    width:400
			});
			$('#shop_type').combobox({    
			    url:'/shopType/combobox',    
			    valueField:'id',    
			    textField:'name',
			    required: true
			});
			var sids = "${(po.sids)!}";
			if(sids)
				$('#shop_id').combotree('setValues', sids.split(","));
		});
		
</script>

<form method="post" id="editForm" name="editForm">
	<input type="hidden" name="shop.id" value="${(po.id)!}" id="poid">
	<div id="tt" class="easyui-tabs" style="width: 786px; height: 450px;">
		<div title="商户信息" style="padding: 5px;">
			<table class="tableForm tableCss">
				<tr>
					<th><font color=red>*</font>商户类别</th>
					<td colspan="3">
						<input id="shop_type" name="shop.type" value="${(po.type)!}"/>
					</td>
				</tr>
				<tr>
					<th><font color=red>*</font>商户名称</th>
					<td><input type="text" name="shop.name" class="easyui-validatebox"value="${(po.name)!}" data-options="required:true"></td>
					<th>商户电话</th>
					<td><input type="text" name="shop.phone" class="easyui-validatebox" value="${(po.phone)!}"></td>
				</tr>
				<#if current_user.id==1>
				<tr>
					<th>子商户</th>
					<td colspan="3">
						<input id="shop_id" name="sids"/>
					</td>
				</tr>
				</#if>
				<tr>
					<th>商户默认定金(元)</th>
					<td colspan="3">
						<input name="shop.front_money" value="${(po.front_money)!0}"/>
					</td>
				</tr>
				<tr>
					<th>商户地址</th>
					<td colspan="3">
					<input type="text" name="shop.address" class="easyui-validatebox" value="${(po.address)!}" style="width:200px;"></td>
				</tr>
				<tr>
					<th>工作时间描述</th>
					<td colspan="3"><input type="text" name="shop.work_hours" class="easyui-validatebox" value="${(po.work_hours)!}" style="width:200px;"></td>
				</tr>
			</table>
		</div>
		<div title="图片" style="padding:5px;">
			<div class="tableForm datagrid-toolbar" >
				<div style="width:60px;border:1px;">
					<span id="upbtn"></span>
				</div>
				<div id="img_div">
					<#if po?? && po.shopImgs??>
						<#list  po.shopImgs as x>
							<div style='float:left;'>
								<input type="hidden" name="logos" value="${x.url}">
								<img src="${x.url}" height="200px"/>
								<br/>
								<a href="#" class="easyui-linkbutton" onclick="javascript:$(this).parent().remove();">删除</a>
							</div>
						</#list>
					</#if>
				</div>
			</div>
		</div>
		<div title="商户备注" style="padding:5px;">
			<textarea name="shop.remark" class="keditor" style="width:750px;height:400px;">${(po.remark)!}</textarea>
		</div>
	</div>
</form>
